package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.FollowRelation;
import cn.wolfcode.trip.base.service.IFollowRelationService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/addFriend")
public class FollowController {
    @Autowired
    private IFollowRelationService followRelationService;

    /*关注,取消关注功能*/
    @PostMapping
    public Object addFriend(FollowRelation entity,String action){
        followRelationService.addFriend(entity,action);
        return new JSONResult();
    }


    /*判断是否关注
    * */
    @GetMapping
    public Object isFan(Long userId,Long followedId){
        return followRelationService.isFan(userId,followedId);
    }
}